<?
#####################################################
#  COPYRIGHT NOTICE
#####################################################
# In the following statements, the term "this 
# program" refers to all files associated with the
# execution and distribution of Adtrackz.
#
# This Program is Copyright 2004 Jonah Klimack.
# All Rights Reserved. 
#
# Selling the code for this program, modifying 
# and/or redistributing the code for this program
# in part or in whole over the Internet or in any 
# other medium is expressly forbidden. Violators
# will be prosecuted to the fullest extent of the law
# Copyright and header information may not be
# modified.
#
# This program is distributed "as is" and without 
# warranty of any kind, either express or implied.
# In no event shall the liability of Jonah Klimack 
# for any damages, losses and/or causes of 
# action exceed the total amount paid by the 
# user for this software.		
#####################################################
# DO NOT MODIFY ANYTHING IN THIS FILE
#####################################################



require "header.php";

$campaign = mysql_fetch_row(mysql_query("select * from adtrackz_campaigns where ID='$cID'"));

if (!$submit_code && !$submit_campaign)
{
	?>
	<p class="small" align="left">
	Campaigns > Generate Html > Step 1
	</p>
	<p class="heading">Generate Html</p>

<p>This section generates the html code required to track sales and actions on your website. </p>

<p><b>Note 1:</b><br>
You only need to generate the code once for each confirmation page that you have. It is not necessary to add the conversion code more than once even if you are tracking dozens of campaigns. </p>

<p><b>Note 2:</b><br>
You must put the the html code on a non-secure (http, not https) page or it will not track the conversion. This is due to a limitation with cookies. Please consult the <a href="http://www.adtrackzgold.com/manual" target="_new">manual</a> for more information.
</p>

<p>Do you have multiple products and one thank you page? If so, <a href="http://www.adtrackzgold.com/manual" target="_new">click here</a> to learn how to track your sales.

	<br><br>
	<form action=genhtml.php method=post>
	<table width="500" border="0" cellspacing="0" cellpadding="5" align="center" bgcolor="white"  bordercolor="white">
	<tr>
		<td>Generate code for an action or sale.</td>
		<td>
			<select name="type">
			<option value="action">Action</option>
			<option value="sale">Sale</option>
			</select>
		</td>
	</tr>
	<tr>
		<td colspan="2" align="center">
			<br><br><input type="submit" value="Next ->" name="submit_campaign"  >
		</td>
	</tr>
	</table>
	</form>
	<?
}
elseif ($submit_campaign && !$submit_code)
{
	if ($type == "action")
	{
		?>
		<p class="small" align="left">
		Campaigns > Generate Html > Step 2
		</p>

		<form action="genhtml.php" method="post">

		<p>
		This information is used for your records. Enter the product ID, product name, and product description of your choosing. 
		</p><p>
		<p><b>Duplicate Action Protection</b> <br>
		If you are selling 2 or more products, make sure you enter a different ID for each product. For example, for your first product, enter an ID of 01 and for your second product, enter 02. This is how AdTrackzGold prevents duplicate sales from being recorded by the same customer.<p>
		
		</p>
		<table width="500" border="0" cellspacing="0" cellpadding="5" align="center" bgcolor="white"  bordercolor="white">
		<tr>
			<td valign="top">Product ID</td>
			<td valign="top" width="250">
				<input type="text" size="5" maxlength=15 name="productID" value="<?=$userID?>"> 		
			</td>
		</tr>
		<tr>
			<td valign="top">Name</td>
			<td valign="top">
				<input type="text" size="30" maxlength="50" name="name" value="<?=$name?>"> 		
			</td>
		</tr>
		</tr>
			<td valign="top">Description</td>
			<td valign="top">
				<textarea name="description" rows=4 cols=20><?=$description?></textarea> 		
			</td>
		</tr>
		</table>
		<br><br>
		<center>
		<input type=submit name=submit_code value="Generate Code"  >
		<input type=hidden name=type value=<?=$type?>>
		</center>
		</form>
		<br>
	<?
	}
	elseif ($type == "sale")
	{
		?>
		<p class="small" align="left">
		Campaigns > Generate Html > Step 2
		</p>

		<form action="genhtml.php" method="post">

		<p>
		This information is used for your records. Enter the product ID, product name, and product description of your choosing. The revenue is how much your product sells for.
		<p><b>Duplicate Action Protection</b> <br>
		If you are selling 2 or more products, make sure you enter a different ID for each product. For example, for your first product, enter an ID of 01 and for your second product, enter 02. This is how AdTrackzGold prevents duplicate sales from being recorded by the same customer.<p>
		</p>
		<table width="500" border="0" cellspacing="0" cellpadding="5" align="center" bgcolor="white"  bordercolor="white">
		<tr>
			<td valign="top">Revenue</td>
			<td valign="top">
				<input type="text" size="6" maxlength="10" name="revenue" value="0.00"> 		
			</td>
		</tr>
		<tr>
			<td valign="top">Product ID</td>
			<td valign="top" width="250">
				<input type="text" size="5" maxlength=15 name="productID" value="<?=$userID?>"> 		
			</td>
		</tr>
		<tr>
			<td valign="top">Name</td>
			<td valign="top">
				<input type="text" size="30" maxlength="50" name="name" value="<?=$name?>"> 		
			</td>
		</tr>
		</tr>
			<td valign="top">Description</td>
			<td valign="top">
				<textarea name="description" rows=4 cols=20><?=$description?></textarea> 		
			</td>
		</tr>
		</table>
		<br><br>
		<center>
		<input type=submit name=submit_code value="Generate Code"  >
		<input type=hidden name=type value=<?=$type?>>
		</center>
		</form>
		<br>
		<?
	}
}
elseif (!$submit_campaign && $submit_code)
{
if ($type == "action")
	{
		$productID = urlencode ($productID);
		$name = urlencode ($name);
		$description = urlencode ($description);

		?>
		<p class="small" align="left">
		Campaigns > Generate Html > Step 3
		</p>

<p>
		Place this HTML code on the page that your visitor will see after the action. It is best to put this code near the top of your page, right after the opening body tag. </p>

<p><b>Note:</b><br>
  You must put the the html code on a non-secure (http, not https) page or it 
  will not track the conversion. This is due to a limitation with cookies. Please 
  consult the <a href="http://www.adtrackzgold.com/manual" target="_new">manual</a> 
  for more information. </p>

		<br><br>
		<form>
		<textarea rows=10 cols=60>
&lt;!--Start AdTrackzGold Conversion Tracking Code--&gt;
&lt;img src=&#34;http://<?=$domain?>/<?=$udirectory?>/a.php?type=<?=$type?>&id=<?=$productID?>&name=<?=$name?>&description=<?=$description?>&#34; width=1 height=1&gt;	
&lt;!--End AdTrackzGold Conversion Tracking Code--&gt;
		</textarea>
		</form>
		<?
	}
	elseif ($type == "sale")
	{
		if (!$revenue)
			error("You must enter a value for revenue.");
		elseif (!preg_match("/\b\d+\.\d{2}\b/", $revenue))
			error("Revenue must be in 0.00 format.");
		else
		{
			$productID = urlencode ($productID);
			$name = urlencode ($name);
			$description = urlencode ($description);
			?>
			<p class="small" align="left">
			Campaigns > Generate Html > Step 3
			</p>

<p>
			Place this HTML code on the page that your visitor will see after the sale. It is best to put this code near the top of your page, right after the opening body tag.</p>
			
<p><b>Note:</b><br>
  You must put the the html code on a non-secure (http, not https) page or it 
  will not track the conversion. This is due to a limitation with cookies. Please 
  consult the <a href="http://www.adtrackzgold.com/manual" target="_new">manual</a> 
  for more information. </p>
			<br><br>
			<form>
			<textarea rows=10 cols=60>
&lt;!--Start AdTrackzGold Conversion Tracking Code--&gt;
&lt;img src=&#34;http://<?=$domain?>/<?=$udirectory?>/a.php?type=<?=$type?>&value=<?=$revenue?>&id=<?=$productID?>&name=<?=$name?>&description=<?=$description?>&#34;  width=1 height=1&gt;
&lt;!--End AdTrackzGold Conversion Tracking Code--&gt;
			</textarea>
			</form>
			<?
		}
	}
}
?>







<?
require "footer.php";
?>